Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

send opt-in query-compatible header where applicable #2891

Merged
merged 1 commit into from
Nov 7, 2024

Conversation

lucix-aws
Copy link
Contributor

@lucix-aws lucix-aws commented Nov 6, 2024

Adds an opt-in header to query-compatible services. This prevents SDK user from having error shape names swapped out from under them at runtime when services migrate to more performant protocols in the future.

As of today this only affects SQS. Tested:

package main

import (
	"context"

	"github.com/aws/aws-sdk-go-v2/aws"
	"github.com/aws/aws-sdk-go-v2/config"
	"github.com/aws/aws-sdk-go-v2/service/sqs"
)

func main() {
	cfg, err := config.LoadDefaultConfig(context.Background())
	if err != nil {
		panic(err)
	}

	svc := sqs.NewFromConfig(cfg, func(o *sqs.Options) {
		o.Region = "us-east-1"
		o.ClientLogMode = aws.LogRequest
	})

	_, err = svc.ListQueues(context.Background(), nil)
	if err != nil {
		panic(err)
	}
}

result:

SDK 2024/11/06 14:58:59 DEBUG Request
POST / HTTP/1.1
Host: sqs.us-east-1.amazonaws.com
User-Agent: m/E aws-sdk-go-v2/1.32.4 os/macos lang/go#1.23.2 md/GOOS#darwin md/GOARCH#amd64 api/sqs#1.36.4
Content-Length: 2
Amz-Sdk-Invocation-Id: 83842a6c-72c8-43a1-b4c5-08d36038cf64
Amz-Sdk-Request: attempt=1; max=3
Authorization: <...>
Content-Type: application/x-amz-json-1.0
X-Amz-Date: 20241106T195859Z
X-Amz-Security-Token: <...>
X-Amz-Target: AmazonSQS.ListQueues
X-Amzn-Query-Mode: true
Accept-Encoding: gzip

(and service still returns a 200 response, i.e. the sample program does not panic)

@lucix-aws lucix-aws requested a review from a team as a code owner November 6, 2024 19:59
@lucix-aws lucix-aws self-assigned this Nov 7, 2024
@lucix-aws lucix-aws merged commit 1d989f3 into main Nov 7, 2024
13 checks passed
@lucix-aws lucix-aws deleted the feat-querycompatibleheader branch November 7, 2024 15:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants